<?php


namespace App\Http\Controllers\admin\api;


use App\Http\Controllers\admin\service\MaintainService;
use App\Http\Controllers\admin\validate\Maintain;
use App\Http\Controllers\utils\ToolUtil;
use Illuminate\Http\Request;

class MaintainApi
{
    public function addClassify(Request $request){
        $param = $request->all();
        $data = Maintain::addClassify($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::addClassify($param);
    }

    public function queryClassify(Request $request){
        $param = $request->all();
        $data = Maintain::queryClassify($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::queryClassify($param);
    }

    public function deleteClassify(Request $request){
        $param = $request->all();
        $data = Maintain::deleteClassify($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::deleteClassify($param);
    }

    public function queryIdClassify(Request $request){
        $param = $request->all();
        $data = Maintain::queryIdClassify($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::queryIdClassify($param);
    }

    public function editClassify(Request $request){
        $param = $request->all();
        $data = Maintain::editClassify($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::editClassify($param);
    }

    public function addBrand(Request $request){
        $param = $request->all();
        $data = Maintain::addBrand($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::addBrand($param);
    }

    public function queryBrand(Request $request){
        $param = $request->all();
        $data = Maintain::queryBrand($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::queryBrand($param);
    }

    public function deleteBrand(Request $request){
        $param = $request->all();
        $data = Maintain::deleteBrand($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::deleteBrand($param);
    }

    public function queryIdBrand(Request $request){
        $param = $request->all();
        $data = Maintain::queryIdBrand($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::queryIdBrand($param);
    }

    public function editBrand(Request $request){
        $param = $request->all();
        $data = Maintain::editBrand($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::editBrand($param);
    }

    public function addTopic(Request $request){
        $param = $request->all();
        $data = Maintain::addTopic($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::addTopic($param);
    }

    public function queryTopic(Request $request){
        $param = $request->all();
        $data = Maintain::queryTopic($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::queryTopic($param);
    }

    public function queryIdTopic(Request $request){
        $param = $request->all();
        $data = Maintain::queryIdTopic($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::queryIdTopic($param);
    }

    public function editTopic(Request $request){
        $param = $request->all();
        $data = Maintain::editTopic($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::editTopic($param);
    }

    public function deleteTopic(Request $request){
        $param = $request->all();
        $data = Maintain::deleteTopic($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::deleteTopic($param);
    }

    public function uploadMaintainImg(Request $request){
        $param = $request->all();
        $data = Maintain::uploadMaintainImg($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return MaintainService::uploadMaintainImg($param);
    }

}